module.exports = {
    state: {
        contacts: {}
    },
    mutations: {
        contacts (state, data) {
            state.contacts = {
                list: data
            }
        }
    },
    actions: {
        getContacts ({commit, state}, resolve) {
            uid = $store.getters.userID
            $store.api.call('contacts_list', {
                message: '获取通讯录失败',
                form: {id: uid}
            }, ({data}) => {
                commit('contacts', data)
                if(resolve && resolve.call) {
                    resolve(data)
                }
            })
        }
    },
    getters: {
        contactsList (state) {
            return state.contacts
        }
    }
}